import React,{Component} from 'react'
import {Descriptions, Input, DatePicker} from 'antd'
import {inject, observer} from 'mobx-react'
import moment from "moment"
import { ControlFilled } from '@ant-design/icons';
const { RangePicker } = DatePicker;

/**
 * 名称：活动详情
 * 描述：活动编辑编辑
 * 调用：创建活动
 * 输入： 
 * 时间：20220329 
 */
 @inject('activityStore')
 @observer
class ActivityEditDetail  extends Component{
    
    render(){
        const {activityStore,isEdit} = this.props
        const {activityKey,activityName,activityDescription,activityStartTime,activityEndTime} = activityStore
        let dateRange = null;
        let dateParam={}
        if (activityStartTime !== '' || activityEndTime !== '' ){
            dateRange = [moment(activityStartTime,'YYYYMMDD'),moment(activityEndTime,'YYYYMMDD')]
            dateParam['value']=dateRange
        } 
        
        
        return (
            
        <Descriptions title="活动详情">
            <Descriptions.Item label="英文名称">
                <Input disabled={isEdit}  size="small" value={activityKey} onChange={e=>activityStore.setActivityKey(e.target.value)}/>
            </Descriptions.Item>
            <Descriptions.Item label="名称" >
                <Input  size="small" value={activityName} onChange={e=>activityStore.setActivityName(e.target.value)}/>
            </Descriptions.Item>
            <Descriptions.Item label="描述">
                <Input  size="small" value={activityDescription} onChange={e=>activityStore.setActivityDescription(e.target.value)}/>
            </Descriptions.Item>
           
            <Descriptions.Item label="活动期限" span={3}>{}
                <RangePicker {...dateParam} onChange={
                    e=> {
                        activityStore.setActivityStartTime(moment(e[0]).format('YYYYMMDD'))
                        activityStore.setActivityEndTime(moment(e[1]).format('YYYYMMDD'))
                        
                    }}
                    />
            </Descriptions.Item>
            
        </Descriptions>
       
        )
    }

    

}
export default ActivityEditDetail
